﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace vn_edu_hcmup_fit_k34_c104_sta_04a_calc
{
    class Program
    {
        static void Main(string[] args)
        {
            int iOp1, iOp2;
            while (true)
            {
                while (true)
                {
                    Console.Write("Enter first operand: ");
                    string sOp1 = Console.ReadLine();
                    try
                    {
                        iOp1 = int.Parse(sOp1);
                        break;
                    }
                    catch
                    {
                        // do nothing
                    }
                }

                while (true)
                {
                    Console.Write("Enter second operand: ");
                    string sOp2 = Console.ReadLine();
                    try
                    {
                        iOp2 = int.Parse(sOp2);
                        break;
                    }
                    catch
                    {
                        // do nothing
                    }
                }

                Console.WriteLine("Sum is: " + (iOp1 + iOp2).ToString());
                Console.Write("Try again? (y/n)");
                if (Console.ReadLine() == "n")
                {
                    break;
                }
            }
        }
    }
}
